import { Button, Form, Modal, Table, Input } from "antd";
import { useRef, useState } from "react";
import request from "../../framework/common/utils/request";
import qs from "qs";
import { useForm } from "../../framework/common/context/metadata-context";
import useTable from "../../framework/common/lifecycle/useTable";
import message from "../../framework/common/utils/message";

import { useUpdate } from "ahooks";

/**
 * url - 通过获取后端接口后，跳转到转换后的流程地址
 */
function openReationProcess({
  url
}){

  if(!url){
    return Promise.resolve();
  }

  return request({
    url: '/flowinstance/approval/build-relation-process-url',
    method: 'POST',
    data: {
        url: url,
    }
  }).then(
    function(result){
      if(result.code === 1 && result?.data?.url){
        window.open(result?.data?.url);
      }else{
        window.open(url);
      }
    },
    function(){
      window.open(url)
    }
  );
}

export {
  openReationProcess//跳转到关联路程页面
}